package drename;

import java.io.File;

public class Rename {
	public static void main(String[] args) {
		File file = new File("input_data/temp_solution");
		for(File pfile:file.listFiles()){
			if(!pfile.isDirectory()){
				String name = pfile.getName();
				String[] nameList = name.split("-");
				if(nameList.length>1){
					StringBuffer path = new StringBuffer("output_data/");
					String algName = nameList[0];
					path.append(algName+"/");
					String probName = nameList[1];
					path.append(probName.substring(0, 5)+"/");
					String fileName = "";
					if(nameList[1].length()==8)
						fileName = nameList[1].substring(6, 7);
					else if(nameList[1].length()==9)
						fileName = nameList[1].substring(6, 8);
					
					String runStr = nameList[2].split("\\.")[0];
					int runTime = Integer.parseInt(nameList[2].substring(3, 4));
					if(runStr.length()==4)
						path.append("FUN_").append(fileName).append("D_").append(runTime);
					else 
						path.append("FUN_").append(fileName).append("D_").append(nameList[2].substring(3, 5));
					System.out.println(path);
					pfile.renameTo(new File(path.toString()));
				}
			}
		}
	}
}
